package com.example.testcontract.activity;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.testcontract.R;

/**
 * Created by admin on 2014/9/18.
 */
public class ContactInformationActivity extends Activity {

    TextView showName;
    TextView showPhone;
    Button dial;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.show_information);

        showName = (TextView) findViewById(R.id.show_name);
        showPhone = (TextView) findViewById(R.id.show_phone);
        dial = (Button) findViewById(R.id.dial);

        Bundle bundle = getIntent().getExtras();
        showName.setText(bundle.getString("name", ""));
        showPhone.setText(bundle.getString("phoneNum", ""));

        dial.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String number = showPhone.getText().toString();
                Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+number));
                startActivity(intent);
            }
        });
    }
}